package com.simple.business.service.sms;


import com.github.zuihou.base.R;
import com.github.zuihou.context.BaseContextHandler;
import com.simple.business.domain.dto.sms.VerificationCodeDTO;
import com.simple.business.domain.enumeration.VerificationCodeBusinessTypeEnum;
import com.simple.common.utils.SecurityUtils;

public interface VerificationCodeService {

    /**
     *
     * @param userName 手机号或者邮箱号
     * @param code 验证码
     * @param checkUser 是否检查发送者
     * @param userId 当前进行验证的用户id
     * @param useOnce 验证后删除，只用一次
     * @return
     */
    R<Boolean> codeCheck(String userName, String code,  boolean checkUser, Long userId, boolean useOnce);

    default R<Boolean> codeCheck(String account, String code) {
        return codeCheck(account, code, false, SecurityUtils.getUserId(),true);
    }

    R<String> sendSmsCode(String mobile);


    R<String> sendEmailCode(String email);


    void deleteCode(String account);

}
